unit uAdvancedLog;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, SynEdit, SynMemo, ExtCtrls;

type
  TfmLogAdvanced = class(TForm)
    Panel1: TPanel;
    AdvLogMemo: TSynMemo;
    CheckBox1: TCheckBox;
    Button1: TButton;
    SaveDialog1: TSaveDialog;
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmLogAdvanced: TfmLogAdvanced;

implementation

uses uMain;

{$R *.dfm}

procedure TfmLogAdvanced.FormDestroy(Sender: TObject);
begin
  if CheckBox1.Checked then AdvLogMemo.Lines.SaveToFile(SaveDialog1.InitialDir+'\autosave.log');
end;

procedure TfmLogAdvanced.Button1Click(Sender: TObject);
begin
  if SaveDialog1.Execute then AdvLogMemo.Lines.SaveToFile(SaveDialog1.FileName);
end;

procedure TfmLogAdvanced.FormShow(Sender: TObject);
begin
  SaveDialog1.InitialDir := fmMain.BasePath+'\log';
end;

procedure TfmLogAdvanced.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if CheckBox1.Checked then AdvLogMemo.Lines.SaveToFile(fmMain.BasePath+'\log\advlog.log');
end;

end.
